package com.servlet;

import java.io.IOException;
import java.util.HashMap;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.service.goodsService;

/**
 * 
 * 功能描述：主页Servlet
 * 
 * Version： 1.0
 * 
 * date： 2016年6月22日 下午6:18:30
 * 
 * @author：XiaoBingBy
 *
 */
public class indexServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
       
    public indexServlet() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		
		//调用业务方法  拿到首页数据
		goodsService goodsService = new goodsService();
		HashMap<String, List> AllSorts = goodsService.goodListService();//所有的数据
		
		//存入session 中 页面取session数据
		HttpSession session = request.getSession();
		session.setAttribute("AllSorts", AllSorts);
	}

	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
